Originally, the Ethernet is mainly applied to a local area network (Local Area Network, referred to as LAN) environment, and operations, administration and maintenance (Operations, Administration and Maintenance, referred to as OAM) capability is weaker. At present, only a management system at a network element level is available. A management tool of the management system is not enough to support network management that is required by a public telecommunication network. After an Ethernet technology is applied in a metropolitan area network, a demand for an OAM function is increasingly concerned. The International Telecommunication Union (International Telecommunication Union, referred to as ITU) proposes the Y.1731 protocol to solve an OAM problem of the Ethernet. OAM is mainly divided into fault management and performance management, where an important part of the performance management is packet loss detection.
The Y.1731 protocol mainly proposes two measurement modes for packet loss detection: dual-ended lost-measure (dual-ended lost-measure) and single-ended lost-measure (single-ended lost-measure). The dual-ended lost-measure and the single-ended lost-measure are generally preformed between two routers that are connected through an intermediate device. Principles of the two modes of packet loss detection are similar. A first router that initiates packet loss detection needs to send a packet loss detection packet to a second router at a peer end. The second router at the peer end returns a count value of received packets and a count value of sent packets, where the count value of received packets and the count value of sent packets are locally recorded, so that at some time point, the first router that initiates packet loss detection may not only obtain a count value of received packets and a count value of sent packets, where the count value of received packets and the count value of sent packets are locally recorded, but also know the count value of received packets and the count value of sent packets of the second router. Subsequently, at a next time point, the first router initiates packet loss detection again. By calculating a difference between respective four count values at the two time points according to a preset formula, the number of lost packets may be measured.
During implementation of the present disclosure, however, the inventor finds that the prior art has at least the following problems: A packet transmitted in a virtual private network (Virtual Private Network, referred to as VPN), such as a virtual private local area network service (Virtual Private LAN Service, referred to as VPLS) or a virtual leased line (Virtual Leased Line, referred to as VLL), is transmitted over a pseudo-wire (Pseudo-Wire, referred to as PW), and the PW may also be known as a pseudo circuit or a tunnel. Multiple PWs may exist in a VPN at the same time. Each PW may carry packets of multiple types of service flows at the same time. A service flow corresponding to a packet transmitted in a PW has different classes of service (Class of Service, referred to as CoS), that is, has different scheduling priorities for sending. A certain CoS value should also be set for a packet loss detection packet. When the preceding packet loss detection solution is implemented for a packet in a PW, disorder occurs no matter which CoS value is set for the packet loss detection packet. If a largest CoS value is set for the packet loss detection packet, when the packet loss detection packet is sent after packets of other service flows are sent, an intermediate device sends the packet loss detection packet preferentially because the packet loss detection packet has a higher priority. In this way, the packet loss detection packet arrives at a router at a peer end before other packets. As a result, a count value of received packets, obtained by the router at the peer end at this time, does not include a packet that arrives subsequently. On the contrary, if a CoS value of the packet loss detection packet is set to a low priority, the packet loss detection packet is sent by the intermediate device after other packets are sent. As a result, a count value of received packets, obtained by the router at the peer end, includes a packet that arrives previously. In preceding cases, measurement results are both not accurate.
In the prior art, an in-line real time flow monitoring (In-Line Real-time Flow Monitoring, referred to as IRSM) detection solution is further provided. IRSM detection is detection based on a service flow. In this detection solution, a service packet is duplicated for each service flow, and the service packet carries a count value of received and sent packets. This technical solution is based on a service flow, however, is not applicable to a situation where packet loss is detected in a PW. Generally, a PW carries thousands of service flows. In the IRSM detection solution, one IRSM detection flow needs to be deployed for each service flow, resulting in a huge waste of a PW bandwidth.